package cn.tedu.lucky.draw.server.job.listener;

import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

public class ActivityCsvToDBListener implements JobExecutionListener {
    @Override
    public void beforeJob(JobExecution jobExecution) {
        long begin = System.currentTimeMillis();
        jobExecution.getExecutionContext().putLong("begin",begin);
        System.out.println("开始执行，当前时间是："+begin);
    }

    @Override
    public void afterJob(JobExecution jobExecution) {
        long begin = jobExecution.getExecutionContext().getLong("begin");
        long end = System.currentTimeMillis();
        System.out.println("执行结束，当前时间是："+end);
        System.out.println("共消耗时间："+(end-begin));

    }
}
